package day11.KeJian;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class MyVariableParameter4 {
    // static <E>  List<E>  of(E…elements)  创建一个具有指定元素的List集合对象
    //static <E>  Set<E>  of(E…elements)    创建一个具有指定元素的Set集合对象
    //static <K , V>   Map<K，V>  of(E…elements) 创建一个具有指定元素的Map集合对象
    public static void main(String[] args) {
        method1();
        method2();
        method3();
        method4();
    }
    private static void method1() {
        List<String> list = List.of("a", "b", "c", "d");
        System.out.println(list);
        ArrayList<String> list1 = new ArrayList<>(List.of("a", "b", "c", "d"));
        System.out.println(list1);
    }
    private static void method2() {
        Set<String> set = Set.of("a", "b", "c", "d");
        System.out.println(set);


    }
    private static void method3() {
        Map<String, String> map = Map.of("小黑", "山西", "小白", "蒙古", "小粉", "上海");
        System.out.println(map);


    }
    private static void method4(){
        Map<Object, Object> map1 = Map.ofEntries(
          Map.entry("胖虎","13区"),
                Map.entry("大雄","13区"));
        System.out.println(map1);
    }
}
